package com.jeesite.modules.yzw.service;

import com.jeesite.common.collect.ListUtils;
import com.jeesite.modules.sys.entity.User;
import com.jeesite.modules.yzw.dao.OtsIflytekUserDao;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 易政网Service
 * @author guohusong
 * @version 1.0
 * @date 2022/4/30 10:12
 */
@Service
public class YzwService {
    private static final Logger logger = LoggerFactory.getLogger(YzwService.class);
    @Resource
    private OtsIflytekUserDao otsIflytekUserDao;

    /**
     * 查询易政网与系统关联用户
     * @param empUserMap
     * @return
     */
    public Map findYzwList(Map empUserMap){
        List yzwList = otsIflytekUserDao.findYzwList(empUserMap);
        if(ListUtils.isNotEmpty(yzwList)){
            return (Map) yzwList.get(0);
        }
        return null;
    }

    /**
     * 查看登录用户是否包含某个菜单
     * @param menuMap
     * @return
     */
    public boolean findYzwMenu(Map menuMap){
        List yzwList = otsIflytekUserDao.findYzwMenu(menuMap);
        return ListUtils.isNotEmpty(yzwList);
    }

    public User getUserByUserCode(String userId) {
        return otsIflytekUserDao.getUserByUserCode(userId);
    }
}
